package com.CoreryBlack.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Order(8)
@Slf4j
//@Component
//@Aspect
public class MyAspect2 {

    //前置通知
    //@Before("execution(public void com.itheima.service.impl.DeptServiceImpl.delete(java.lang.Integer))")
    //@Before("execution(void com.itheima.service.impl.DeptServiceImpl.delete(java.lang.Integer))")
    //@Before("execution(void com.itheima.service.impl.DeptServiceImpl.delete(*))")
    //@Before("execution(* com.itheima.service.impl.DeptServiceImpl.*(..))")
    //@Before("execution(* com.itheima.service.impl.*.*(..))")
    //@Before("execution(* com.itheima.service.impl.DeptServiceImpl.del*(..))")

    //@Before("execution(* com..service.*.*(..))")
    //@Before("execution(* *(..))") //慎用!!!!!!!!!! --- 性能越差

//    @Before("execution(* com.itheima.service.impl.DeptServiceImpl.list()) ||  " +
//            "execution(* com.itheima.service.impl.DeptServiceImpl.save(*))")

    //@Before("execution(* com.itheima.service.DeptService.*(..))") //切入点表达式可以基于接口进行匹配

    @Before("@annotation(com.itheima.anno.Log)")
    public void before(){
        log.info("MyAspect2 -> before ...");
    }







    //后置通知
//    @After("execution(* com.itheima.service.impl.DeptServiceImpl.*(..))")
//    public void after(){
//        log.info("MyAspect2 -> after ...");
//    }

}
